define(['knockout', 'jquery', 'text!./qs-win.html'], function (ko, $, templateMarkup) {

    function QuerySchemeWindow(params) {
    	this.id = params.id;
        this.entityfields = [
            "姓名",
            "销量",
            "单价"
        ];
        this.queryfields = ko.observableArray([
            "姓名",
            "销量",
            "单价"
        ]);

        this.initWin = function () {
            $(this.element).jqxWindow({ okButton: $(this.element).find('#btn_OK') });
            $(this.element).jqxWindow({ cancelButton: $(this.element).find('#btn_Cancel') });
            
            $(this.element).find("#tabA").jqxTabs({ theme: "admin" , height: '415px', width:  '100%' });
        
            $(this.element).on('open', function (event) {

            });

            $(this.element).on('close', function (event) {

            });
            
        }
    }

    // This runs when the component is torn down. Put here any logic necessary to clean up,
    // for example cancelling setTimeouts or disposing Knockout subscriptions/computeds.
    QuerySchemeWindow.prototype.dispose = function () { };

    return {
        viewModel: {
            createViewModel: function (params, componentInfo) {
                var initialData = [
                    { name: "Well-Travelled Kitten", sales: 352, price: 75.95 },
                    { name: "Speedy Coyote", sales: 89, price: 190.00 },
                    { name: "Furious Lizard", sales: 152, price: 25.00 },
                    { name: "Indifferent Monkey", sales: 1, price: 99.95 },
                    { name: "Brooding Dragon", sales: 0, price: 6350 },
                    { name: "Ingenious Tadpole", sales: 39450, price: 0.35 },
                    { name: "Optimistic Snail", sales: 420, price: 1.50 }
                ];
                
                return new QuerySchemeWindow({id: params.id, items: initialData });
            }
        },
        template: templateMarkup
    };

});
